<extend name="Common/common"/>

<block name="content">
<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-member-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>标签名称：</label>
			<div class="formControls col-xs-8 col-sm-7">
				<input type="text" class="input-text" value="{$tag['name']}" placeholder="" name="name">
			</div>
		</div>
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
				<notempty name='tag'>
					<input type="hidden" name="tag_id" value="{$tag['id']}"/>
				</notempty>
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>

<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-member-add").validate({
		rules:{
			name:{
				required:true,
				minlength:2,
				maxlength:16
			},
			
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form) {
			var index = layer.load(2, {shade: [0.5,'#ccc']});
	        $(form).ajaxSubmit({
	        	type: 'post', // 提交方式 get/post
	            url: '{:U("tagsAdd")}', // 需要提交的 url
	            success: function(data) { // data 保存提交后返回的数据，一般为 json 数据
	                layer.close(index);
	            	if(data.status == 1){
	            		layer.msg(data.msg,{icon:6,time:1000});
	            		setTimeout(function(){
	            			var index = parent.layer.getFrameIndex(window.name);
							parent.location.reload();
							parent.layer.close(index);
	            		},1000);
	            	}else{
	            		layer.msg(data.msg,{icon:5,time:1000});
	            	}
	            }
	        });
	    }
	});
});
</script> 

	
</block>